package com.security.view.utils;

import java.util.ArrayList;
import java.util.List;

import javax.faces.model.SelectItem;

import com.archtecture.control.enums.Arquivo;
import com.archtecture.control.models.ModelAb;
import com.archtecture.view.utils.UtilWeb;
import com.security.control.enums.SimNao;
import com.security.control.enums.Status;

public class UtilSelectItens {

	public static List<SelectItem> getSelectItemSimNao() {

		List<SelectItem> list = new ArrayList<SelectItem>();
		for (SimNao item : SimNao.values()) {
			list.add(new SelectItem(item, UtilWeb.obterTextoArquivo(Arquivo.LABELS, item)));
		}
		return list;

	}

	public static List<SelectItem> getSelectItemStatus() {

		List<SelectItem> list = new ArrayList<SelectItem>();
		for (Status item : Status.values()) {
			list.add(new SelectItem(item, UtilWeb.obterTextoArquivo(Arquivo.LABELS, item)));
		}
		return list;

	}

	public static <Model extends ModelAb> List<SelectItem> getSelectItemGenerico(List<Model> listElementos) {
		
		List<SelectItem> list = new ArrayList<SelectItem>();
		list.add(new SelectItem(null, "Selecione"));
		for (Model model : listElementos) {
			list.add(new SelectItem(model, model.getNome()));
		}
		
		return list;
	}
}
